

const path = require('path')

const { makeExecutableSchema } = require('@graphql-tools/schema')
const { mergeTypeDefs, mergeResolvers } = require('@graphql-tools/merge')
const { loadFilesSync } = require('@graphql-tools/load-files')

const typeDefsArray = loadFilesSync(path.join(__dirname, './typeDefs'))
const tresolversArray = loadFilesSync(path.join(__dirname, './resolvers'))


const typeDefs = mergeTypeDefs(typeDefsArray)
const resolvers = mergeResolvers(tresolversArray)

module.exports = makeExecutableSchema({
  typeDefs,
  resolvers
})